home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_222 / plplot / src / source.zoo / plztx.c < prev    next >
C/C++ Source or Header  |  1989-05-15  |  1KB  |  54 lines

  1. /* Prints out text along a vertical axis for a 3d plot joining         */
  2. /*  world coordinates (wx,wy1) to (wx,wy2).                            */
  3.  
  4. #include "plplot.h"
  5. #include <math.h>
  6.  
  7. void plztx(opt,dx,dy,wx,wy1,wy2,disp,pos,just,text)
  8. float dx,dy,wx,wy1,wy2,disp,pos,just;
  9. char *opt, *text;
  10. {      
  11.       int refx, refy;
  12.       int vert;
  13.       float shift, cc, ss, def, ht;
  14.       float xform[4], diag;
  15.       float xscl, xoff, yscl, yoff, wy;
  16.    
  17.       gchr(&def,&ht);
  18.       gwm(&xscl,&xoff,&yscl,&yoff);
  19.       cc = xscl * dx;
  20.       ss = yscl * dy;
  21.       diag = sqrt(cc*cc + ss*ss);
  22.       cc = cc/diag;
  23.       ss = ss/diag;
  24.       gmp(&xscl,&xoff,&yscl,&yoff);
  25.  
  26.       shift = 0.0;
  27.       if (just != 0.0) shift = plstrl(text) * just;
  28.       wy = wy1 + pos * (wy2 - wy1);
  29.       
  30.       if (strpos(opt,'V') != -1 || strpos(opt,'v') != -1) {
  31.         vert = 0;
  32.         refx = mmpcx(wcmmx(wx) - (disp * ht + shift) * cc);
  33.         refy = mmpcy(wcmmy(wy) - (disp * ht + shift) * ss);
  34.       }
  35.       else if (strpos(opt,'H') != -1 || strpos(opt,'h') != -1) {
  36.         vert = 1;
  37.         refy = wcpcy(wy) - yscl*(disp*ht*ss+shift);
  38.         refx = mmpcx(wcmmx(wx) - disp*ht*cc);
  39.       }
  40.       if (vert) {
  41.         xform[0] = 0.0;
  42.         xform[1] = -cc;
  43.         xform[2] = 1.0;
  44.         xform[3] = -ss;
  45.       }
  46.       else {
  47.         xform[0] = cc;
  48.         xform[1] = 0.0;
  49.         xform[2] = ss;
  50.         xform[3] = 1.0;
  51.       }
  52.       plstr(0,xform,refx,refy,text);
  53. }
  54.